<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Blade;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
        Schema::defaultStringLength(191);

        Blade::directive('node', function($node) {
          return "<?php if (\\App\\Model\\AdminUserModel::hasNode($node)): ?>";
        });

        Blade::directive('endnode', function($node) {
            return "<?php endif; ?>";
        });

        Blade::directive('role', function($role) {
          return "<?php if (\\App\\Model\\AdminUserModel::hasRole($role)): ?>";
        });

        Blade::directive('endrole', function($role) {
            return "<?php endif; ?>";
        });

        Blade::directive('stow', function($goods_id) {
          return "<?php if (\\App\\Model\\HomeUserStow::hasStow($goods_id)): ?>";
        });

        Blade::directive('elsestow', function($goods_id) {
          return "<?php else: ?>";
        });

        Blade::directive('endstow', function($goods_id) {
            return "<?php endif; ?>";
        });

        Blade::directive('auth', function() {
          return "<?php if (\\App\\Model\\HomeUserStow::ifAuth()): ?>";
        });

        Blade::directive('endauth', function() {
            return "<?php endif; ?>";
        });

        Blade::directive('sale', function() {
          return "<?php if (\\App\\Model\\Goodssale::hasSale()): ?>";
        });

        Blade::directive('endsale', function() {
            return "<?php endif; ?>";
        });




    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}
